<?php
$message = htmlspecialchars(trim(addslashes($_POST['message_group'])));
	$submit = $_POST['submit'];
	$sfera = $row_group['tutorial'];
	$username =  $_SESSION['username'];
	$title = $row_group['title_group'];
	$from_who = $row_group['from_who'];
	$date=time();
	
	$sel_s = "SELECT * FROM groups_mess WHERE comment='".$message."'";
	$sel_que = mysql_query($sel_s);
	$broi = mysql_num_rows($sel_que);

	if((strlen($message)> 1) && ($submit == true) && ($broi==0)) {
		$ins= 'INSERT INTO groups_mess(from_who, title_group, who_comment, comment, date) 
				VALUES("'.$from_who.'", "'.$title.'", "'.$username.'", "'.$message.'", "'.$date.'")' or die(mysql_error());
		$ins_q = mysql_query($ins) or die(mysql_error());
	} elseif((strlen($message)< 2) && ($submit != true) && ($broi!=0)) {
		echo "ERROR";
	}
?>